home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / tex / sspell14.zip / README < prev    next >
Text File  |  1992-07-06  |  11KB  |  265 lines

  1.              sspell - similar to Unix spell                       
  2.                         version 1.4                               
  3.                                                                   
  4.  Author: Maurice Castro                                           
  5.  Release Date:  4 Jul 1992                                        
  6.  Bug Reports: maurice@bruce.cs.monash.edu.au                      
  7.                                                                   
  8.  This code has been placed by the Author into the Public Domain.  
  9.  The code is NOT covered by any warranty, the user of the code is 
  10.  solely responsible for determining the fitness of the program    
  11.  for their purpose. No liability is accepted by the author for    
  12.  the direct or indirect losses incurred through the use of this   
  13.  program.                                                         
  14.                                                                   
  15.  Segments of this code may be used for any purpose that the user  
  16.  deems appropriate. It would be polite to acknowledge the source  
  17.  of the code. If you modify the code and redistribute it please   
  18.  include a message indicating your changes and how users may      
  19.  contact you for support.                                         
  20.                                                                   
  21.  The author reserves the right to issue the official version of   
  22.  this program. If you have useful suggestions or changes for the  
  23.  code, please forward them to the author so that they might be    
  24.  incorporated into the official version                           
  25.                                                                   
  26.  Please forward bug reports to the author via Internet.           
  27.  
  28. * Introduction
  29.  
  30. The program SSPELL was written by the author to provide a Unix like
  31. spell checker on a PC. There are several utilities of this type already
  32. available, however, most lacked at least one of the following:
  33.  
  34.     1. Public Domain
  35.     2. Source Code
  36.     3. Simple, editable word list structure
  37.     4. Configurable prefix and suffix list.
  38.     5. To use minimal memory
  39.     6. To have an unlimited word list length
  40.     7. Reasonable speed
  41.     8. Portable
  42.  
  43. The SSPELL program provides all these features. The program currently
  44. compiles under Turbo C++ (Borland) for MS-DOS, DJGCC for MS-DOS, GCC
  45. for Decstations and cc for Unix (OSx for Pyramid, SunOS for Sun 3/50, 
  46. Ultrix for Decstation 2100). Minor modification will be required to 
  47. compile under other Unix variants. 
  48.  
  49. * Features
  50.  
  51. The SSPELL program uses a sorted plain ASCII word list for its dictionary.
  52. This makes adding new words to the list easy. Simply add the words and
  53. re-sort the list. 
  54.  
  55. To gain speed, without loading the complete list into memory, a cache 
  56. of words recently recovered from the word list is maintained, the disk
  57. is only searched if the word is not found in the cache.
  58.  
  59. A suffix/prefix list is used to allow a smaller dictionary to be used.
  60.  
  61. A stop file is provided to permit the exclusion of words. This is typically
  62. used to exclude words that have been incorrectly identified as correct
  63. by applying a rule in the rule list. The stop list is a plain ASCII 
  64. word list.
  65.  
  66. * Operation
  67.  
  68. Edit the config.h file to set up the required default locations and 
  69. compile the code. Place the dictionary in the file specified in the 
  70. config.h and make sure that the index file is writable. SSPELL should 
  71. now be ready for use.
  72.  
  73. The SEPARATOR variable should be set to the subdirectory separator for
  74. your system (Unix '/', MS-DOS '\'). The path to the index, dictionary 
  75. and rule file is determined by concatenating DICT_PATH with the 
  76. separator and the individual file names.
  77.  
  78. Performance gains may be had by altering the parameters found in the 
  79. config.h file. Increasing CACHESIZE increases the memory usage of the
  80. program, but decreases disk search time. IDXSIZ and HASHWID control
  81. the size of the index to the disk file. HASHWID determines the maximum
  82. number of characters compared to determine if an item occurs in a given
  83. slot. IDXSIZ determines the number of slots. 
  84.  
  85. A typical IBM-PC implementation could be written as:
  86.  
  87.     #define DICT_PATH "c:\\utility\\dict"
  88.     #define CFGNAME "sspell.cfg"
  89.     #define DICTIONARY "main.dct"
  90.     #define INDEX "main.idx"
  91.     #define STOP "main.stp"
  92.     #define RULE "rule.lst"
  93.     #define CACHESIZE 1000
  94.     #define ROOTNAME "sspell"
  95.     #define SORT "c:\\dos\\sort"
  96.     #define SEPARATOR "\\"
  97.     
  98.     #define MAXSTR 128
  99.     #define SEPSTR " \n\r\t!@#$%^&*(),.<>~`\":;|/\\{}[]"
  100.  
  101.     /* HASHWID must always be 2 or greater */
  102.     #define HASHWID 8
  103.     #define IDXSIZ 1000
  104.  
  105. * Environment Variable
  106.  
  107. A single Environment Variable named SSPELL is consulted by SSPELL.
  108. If the environment variable is not set then the `hardwired' default 
  109. (ie. the value found in  the `config.h' file) will be used.
  110. The Environment variable specifies a path which is concatenated with a 
  111. separator and a file name to locate the configuration, dictionary, index 
  112. and rule files.
  113.  
  114. * Configuration file
  115.  
  116. If a configuration file (typically named "sspell.cfg") is present in the 
  117. default directory or the directory specified by the SSPELL environment 
  118. variable, the options contained in the file will override the defaults.
  119. These configuration file options can be overridden by command line
  120. options.  Example configuration files are shown below:
  121.  
  122.     # configuration file for SSPELL under MSDOS
  123.     DICT_PATH "c:\\utility\\dict"
  124.     DICTIONARY "main.dct"
  125.     INDEX "main.idx"
  126.     RULE "rule.lst"
  127.     STOP "main.stp"
  128.     SORT "c:\\dos\\sort"
  129.  
  130.     # configuration file for SSPELL under Unix
  131.     DICT_PATH "/usr/dict"
  132.     DICTIONARY "main.dct"
  133.     INDEX "main.idx"
  134.     STOP "main.stp"
  135.     RULE "rule.lst"
  136.     SORT "sort -fu"
  137.  
  138. * Command Line
  139.  
  140. SSPELL has the following command line options:
  141.  
  142.     sspell [-u] [-v] [-x] [-c config] [-D dict] [-I index] [-R rule] 
  143.            [-C cachesize] [-S stop] [file] ...
  144.  
  145. -c    `config' is the pathname of a configuration file.
  146.  
  147. -u     Unsorted. The list of words produced is not sorted and contains
  148.     duplicates.
  149.  
  150. -v    all words not actually in the word list are printed and plausible
  151.     derivations from the word list are indicated
  152.  
  153. -x     all plausible stems are output
  154.  
  155. -D    `dict' is the pathname of an alternate dictionary
  156.  
  157. -I    `index' is the pathname of an alternate index. This should be
  158.     used if using a personalised dictionary or if the index file is 
  159.     unwriteable.
  160.  
  161. -R    `rule' is the pathname of an alternate rule list
  162.  
  163. -S    `stop' is the pathname of an alternate stop file
  164.  
  165. -C    `cachesize' is the size of the cache of words found in the 
  166.     dictionary.
  167.  
  168. SSPELL will take input from a list of files on the command line or from
  169. stdin if no files are supplied.
  170.  
  171. The dictionary must be in sorted order with the capital letters folded onto
  172. the small letters. (Using Unix sort: sort -fu). The case of words in the 
  173. dictionary is significant. Any letter appearing as a capital in the 
  174. dictionary must appear as a capital in the text to be regarded as spelled
  175. correctly.
  176.  
  177. The format of the rule list is fixed. `#' in the first column indicates a 
  178. comment. All other lines are of the form:
  179.  
  180.       pre|post <prefix/suffix> <required> <forbidden> <delete> 
  181.  
  182. Any field not used must be filled with a `-'. The following examples
  183. illustrate the features of the rules.
  184.  
  185.     pre un - - -
  186.     post ive - e -
  187.     post ive e - e
  188.     post ied y ay,ey,iy,oy,uy y
  189.  
  190. The prefix rules are simple, their are no required or forbidden sequences
  191. and nothing to delete. Prefixes must not be more complex.
  192.  
  193. The suffix rules are more complex. These rule specify the ending to be
  194. added to the root after the deletion of the delete field, provided that
  195. the word has a required ending, provided that the combination is not 
  196. forbidden. 
  197.  
  198. Example rule:
  199.     post ive - e -
  200. The word 'transitive' is found in the document, the suffix 'ive' is
  201. removed and there is no deleted suffix to replace.  The new word
  202. 'transit' does not end in the forbidden suffix 'e' and there is
  203. no required ending so a search is made in the dictionary for 'transit'.
  204. The word 'deceive' is found in the document, the suffix 'ive' is